package com.mldong.modules.wf.flow.handlers;

import cn.hutool.core.util.StrUtil;
import com.mldong.modules.wf.engine.AssignmentHandler;
import com.mldong.modules.wf.engine.core.Execution;
import com.mldong.modules.wf.engine.model.TaskModel;

import java.util.Collections;
import java.util.List;

public class OperatorAssignmentHandler implements AssignmentHandler {
    @Override
    public List<String> assign(TaskModel model, Execution execution) {
        List<String> ids = Collections.emptyList();
        if(execution.getProcessInstance()!=null && StrUtil.isNotEmpty(execution.getProcessInstance().getOperator())) {
            ids.add(execution.getProcessInstance().getOperator());
        } else {
            ids.add("apply.operator");
        }
        return ids;
    }

    @Override
    public String getMessage() {
        return "流程发起人";
    }

    @Override
    public int getOrder() {
        return -9999;
    }
}
